<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateTableWalletRecord extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mybank_wallet_record', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('shopId')->default(0)->comment("门店 ID");
            $table->string('merchantId', 64)->default('')->comment('商户号');

            $table->unsignedInteger('transDate')->default(0)->comment('转账时间');
            $table->unsignedTinyInteger('status')->default(0)->comment('状态 1 已提交申请 2 成功 3 失败');
            $table->unsignedTinyInteger('transType')->default(0)->comment('转账类型 0 未知 1 收入 2 支出');
            $table->unsignedTinyInteger('isShow')->default(0)->comment('是否显示 0隐藏 1显示');
            $table->string('displayTransType')->default(0)->comment('转账类型 显示文字');
            $table->string('transDesc')->default('')->comment('转账描述');
            $table->string('transId')->default('')->comment('网商单号');
            $table->unsignedBigInteger('withholdId')->default(0)->comment('协议代扣记录 ID');
            $table->unsignedBigInteger('unfreezeId')->default(0)->comment('余额解冻记录 ID');
            $table->integer('transAmount')->default(0)->comment('转账金额(分)');
            $table->integer('afterRemainingAmount')->default(0)->comment('转账后余额(分)');
            $table->string('remark')->default(1)->comment('备注');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");

            $table->comment = '商户钱包记录';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mybank_wallet_record');
    }
}
